[Dirs] section

This optional section defines any additional directories Setup is to create besides the application directory the user chooses, which is created automatically. Creating subdirectories underneath the main application directory is a common use for this section.

Note that you aren't required to explicitly create directories before installing files to them using the [Files] section, so this section is primarily useful for creating empty directories.

Here is an example of a [Dirs] section:

[Dirs]
Name: "{app}\data"
Name: "{app}\bin"

The example above will, after Setup creates the application directory, create two subdirectories underneath the application directory.

The following is a list of the supported parameters:

Name  (Required)

The name of the directory to create, which normally will start with one of the directory constants.

Example:
Name: "{app}\MyDir"
Attribs

Specifies additional attributes for the directory. This can include one or more of the following: readonly, hidden, system. If this parameter is not specified, Setup does not assign any special attributes to the directory.

If the directory already exists, the specified attributes will be combined with the directory's existing attributes.

Example:
Attribs: hidden system
Permissions

Specifies additional permissions to grant in the directory's ACL (access control list). It is not recommended that you use this parameter if you aren't familiar with ACLs or why you would need to change them, because misusing it could negatively impact system security.

For this parameter to have an effect the user must be running Windows 2000 or later (NT 4.0 is not supported due to API bugs), the directory must be located on a partition that supports ACLs (such as NTFS), and the current user must be able to change the permissions on the directory. In the event these conditions are not met, no error message will be displayed, and the permissions will not be set.

This parameter should only be used on directories private to your application. Never change the ACLs on top-level directories like {sys} or {pf}, otherwise you can open up security holes on your users' systems.

In addition, it is recommended that you avoid using this parameter to grant write access on directories containing program files. Granting, for example, everyone-modify permission on the {app} directory will allow unprivileged users to tamper with your application's program files; this creates the potential for a privilege escalation vulnerability. (However, it is safe to change the permissions on a subdirectory of your application's directory which does not contain program files, e.g. {app}\data.)

The specified permissions are set regardless of whether the directory existed prior to installation.

This parameter can include one or more space separated values in the format:

The following access types are supported for the [Dirs] section:

full

Grants "Full Control" permission, which is the same as modify (see below), but additionally allows the specified user/group to take ownership of the directory and change its permissions. Use sparingly; generally, modify is sufficient.

modify

Grants "Modify" permission, which allows the specified user/group to read, execute, create, modify, and delete files in the directory and its subdirectories.

readexec

Grants "Read & Execute" permission, which allows the specified user/group to read and execute files in the directory and its subdirectories.

Example:
Permissions: authusers-modify
Flags

This parameter is a set of extra options. Multiple options may be used by separating them by spaces. The following options are supported:

deleteafterinstall

Instructs Setup to create the directory as usual, but then delete it once the installation is completed (or aborted) if it's empty. This can be useful when extracting temporary data needed by a program executed in the script's [Run] section.

This flag will not cause directories that already existed before installation to be deleted.

uninsalwaysuninstall

Instructs the uninstaller to always attempt to delete the directory if it's empty. Normally the uninstaller will only try to delete the directory if it didn't already exist prior to installation.

uninsneveruninstall

Instructs the uninstaller to not attempt to delete the directory. By default, the uninstaller deletes any directory specified in the [Dirs] section if it is empty.

Example:
Flags: uninsneveruninstall

Components and Tasks Parameters

Common Parameters